<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>



</head>

<body>
    <img id="scream" src="http://www.runoob.com/try/demo_source/img_the_scream.jpg" alt="The Scream" width="250" height="400">

    
    <canvas id="myCanvas" width="250" height="400" style="border:1px solid #d3d3d3;">

        <script>
            var c = document.getElementById("myCanvas");
            var ctx = c.getContext("2d");
            var img = document.getElementById("scream");

            img.onload = function () {
                ctx.drawImage(img, 0, 0);
            } 
        </script>

</body>

</html>